home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / vbboid / boidmain.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-09-18  |  41.4 KB  |  1,262 lines

  1. VERSION 5.00
  2. Begin VB.Form frmMain 
  3.    Caption         =   "vbBoid : Example of emergent behaviour  
  4.  RL 1999"
  5.    ClientHeight    =   8055
  6.    ClientLeft      =   60
  7.    ClientTop       =   630
  8.    ClientWidth     =   11190
  9.    ForeColor       =   &H8000000F&
  10.    Icon            =   "Boidmain.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   8055
  14.    ScaleWidth      =   11190
  15.    StartUpPosition =   2  'CenterScreen
  16.    Begin VB.Frame Frame4 
  17.       Height          =   8055
  18.       Left            =   0
  19.       TabIndex        =   69
  20.       Top             =   0
  21.       Width           =   1875
  22.       Begin VB.HScrollBar HScroll1 
  23.          Height          =   255
  24.          Index           =   3
  25.          Left            =   120
  26.          Max             =   50
  27.          TabIndex        =   96
  28.          Top             =   360
  29.          Value           =   30
  30.          Width           =   1575
  31.       End
  32.       Begin VB.CommandButton Command1 
  33.          Caption         =   "Clear"
  34.          Height          =   375
  35.          Left            =   960
  36.          TabIndex        =   95
  37.          Top             =   7080
  38.          Width           =   855
  39.       End
  40.       Begin VB.CheckBox chkEnclosed 
  41.          Caption         =   "Enclosed"
  42.          Height          =   375
  43.          Left            =   180
  44.          TabIndex        =   94
  45.          Top             =   6660
  46.          Width           =   1335
  47.       End
  48.       Begin VB.CommandButton cmdExit 
  49.          Caption         =   "Exit"
  50.          Height          =   375
  51.          Left            =   60
  52.          TabIndex        =   87
  53.          Top             =   7500
  54.          Width           =   855
  55.       End
  56.       Begin VB.CheckBox chkShowCentre 
  57.          Caption         =   "Show"
  58.          Height          =   255
  59.          Left            =   840
  60.          TabIndex        =   86
  61.          Top             =   720
  62.          Width           =   735
  63.       End
  64.       Begin VB.HScrollBar HScroll1 
  65.          Height          =   255
  66.          Index           =   0
  67.          Left            =   120
  68.          Max             =   10
  69.          TabIndex        =   85
  70.          Top             =   960
  71.          Value           =   3
  72.          Width           =   1575
  73.       End
  74.       Begin VB.HScrollBar HScroll1 
  75.          Height          =   255
  76.          Index           =   1
  77.          Left            =   120
  78.          Max             =   10
  79.          TabIndex        =   84
  80.          Top             =   1560
  81.          Value           =   3
  82.          Width           =   1575
  83.       End
  84.       Begin VB.HScrollBar HScroll1 
  85.          Height          =   255
  86.          Index           =   2
  87.          Left            =   120
  88.          Max             =   10
  89.          TabIndex        =   83
  90.          Top             =   2160
  91.          Value           =   6
  92.          Width           =   1575
  93.       End
  94.       Begin VB.TextBox Text6 
  95.          Height          =   285
  96.          Left            =   1200
  97.          TabIndex        =   82
  98.          Text            =   ".5"
  99.          Top             =   3060
  100.          Width           =   495
  101.       End
  102.       Begin VB.CommandButton cmdExecute 
  103.          Caption         =   "Execute"
  104.          Height          =   375
  105.          Left            =   60
  106.          TabIndex        =   81
  107.          Top             =   7080
  108.          Width           =   855
  109.       End
  110.       Begin VB.TextBox Text5 
  111.          Height          =   285
  112.          Left            =   1200
  113.          TabIndex        =   80
  114.          Text            =   "80"
  115.          Top             =   2580
  116.          Width           =   495
  117.       End
  118.       Begin VB.CheckBox chkGrid 
  119.          Caption         =   "Show Grid"
  120.          Height          =   255
  121.          Left            =   180
  122.          TabIndex        =   79
  123.          Top             =   5160
  124.          Width           =   1335
  125.       End
  126.       Begin VB.CheckBox chkTrails 
  127.          Caption         =   "Show Trails"
  128.          Height          =   255
  129.          Left            =   180
  130.          TabIndex        =   78
  131.          Top             =   4800
  132.          Width           =   1335
  133.       End
  134.       Begin VB.TextBox Text7 
  135.          Height          =   285
  136.          Left            =   1200
  137.          TabIndex        =   77
  138.          Text            =   "4"
  139.          Top             =   3540
  140.          Width           =   495
  141.       End
  142.       Begin VB.CheckBox chkShowSep 
  143.          Caption         =   "Show "
  144.          Height          =   255
  145.          Left            =   840
  146.          TabIndex        =   76
  147.          Top             =   1320
  148.          Width           =   735
  149.       End
  150.       Begin VB.CheckBox chkShowAlign 
  151.          Caption         =   "Show "
  152.          Height          =   255
  153.          Left            =   840
  154.          TabIndex        =   75
  155.          Top             =   1920
  156.          Width           =   855
  157.       End
  158.       Begin VB.CheckBox chkShowSensor 
  159.          Caption         =   "Show Vision"
  160.          Height          =   255
  161.          Left            =   180
  162.          TabIndex        =   74
  163.          Top             =   4440
  164.          Width           =   1335
  165.       End
  166.       Begin VB.CheckBox chkShowBox 
  167.          Caption         =   "Show Obstacle Box"
  168.          Height          =   375
  169.          Left            =   180
  170.          TabIndex        =   73
  171.          Top             =   5520
  172.          Width           =   1335
  173.       End
  174.       Begin VB.CheckBox chkShowColours 
  175.          Caption         =   "Show Colours"
  176.          Height          =   255
  177.          Left            =   180
  178.          TabIndex        =   72
  179.          Top             =   4080
  180.          Width           =   1335
  181.       End
  182.       Begin VB.CheckBox chkShowArrow 
  183.          Caption         =   "Show Arrow"
  184.          Height          =   375
  185.          Left            =   180
  186.          TabIndex        =   71
  187.          Top             =   5940
  188.          Width           =   1335
  189.       End
  190.       Begin VB.CheckBox chkShowCircle 
  191.          Caption         =   "Show Circle"
  192.          Height          =   375
  193.          Left            =   180
  194.          TabIndex        =   70
  195.          Top             =   6300
  196.          Width           =   1335
  197.       End
  198.       Begin VB.Label Label3 
  199.          Caption         =   "Boid Count"
  200.          Height          =   255
  201.          Index           =   6
  202.          Left            =   120
  203.          TabIndex        =   97
  204.          Top             =   120
  205.          Width           =   1695
  206.       End
  207.       Begin VB.Label Label3 
  208.          Caption         =   "Centre"
  209.          Height          =   255
  210.          Index           =   0
  211.          Left            =   120
  212.          TabIndex        =   93
  213.          Top             =   720
  214.          Width           =   735
  215.       End
  216.       Begin VB.Label Label3 
  217.          Caption         =   "Separate"
  218.          Height          =   255
  219.          Index           =   1
  220.          Left            =   120
  221.          TabIndex        =   92
  222.          Top             =   1320
  223.          Width           =   735
  224.       End
  225.       Begin VB.Label Label3 
  226.          Caption         =   "Align"
  227.          Height          =   255
  228.          Index           =   2
  229.          Left            =   120
  230.          TabIndex        =   91
  231.          Top             =   1920
  232.          Width           =   735
  233.       End
  234.       Begin VB.Label Label3 
  235.          Caption         =   "Sensor Range (Pix)"
  236.          Height          =   495
  237.          Index           =   3
  238.          Left            =   120
  239.          TabIndex        =   90
  240.          Top             =   2580
  241.          Width           =   975
  242.       End
  243.       Begin VB.Label Label3 
  244.          Caption         =   "Max Turn (Rad)"
  245.          Height          =   495
  246.          Index           =   4
  247.          Left            =   120
  248.          TabIndex        =   89
  249.          Top             =   3060
  250.          Width           =   735
  251.       End
  252.       Begin VB.Label Label3 
  253.          Caption         =   "Field of View (Rad)"
  254.          Height          =   495
  255.          Index           =   5
  256.          Left            =   120
  257.          TabIndex        =   88
  258.          Top             =   3540
  259.          Width           =   855
  260.       End
  261.    End
  262.    Begin VB.Frame Frame3 
  263.       Height          =   7215
  264.       Left            =   11760
  265.       TabIndex        =   1
  266.       Top             =   480
  267.       Visible         =   0   'False
  268.       Width           =   3375
  269.       Begin VB.CommandButton cmdSet 
  270.          Caption         =   "Set Boids"
  271.          Height          =   375
  272.          Left            =   1080
  273.          TabIndex        =   68
  274.          Top             =   6120
  275.          Width           =   1095
  276.       End
  277.       Begin VB.CommandButton cmdClear 
  278.          Caption         =   "Clear"
  279.          Height          =   375
  280.          Left            =   2160
  281.          TabIndex        =   67
  282.          Top             =   6120
  283.          Width           =   1095
  284.       End
  285.       Begin VB.CommandButton cmdCalcForces 
  286.          Caption         =   "Calc Forces"
  287.          Height          =   375
  288.          Left            =   0
  289.          TabIndex        =   66
  290.          Top             =   6480
  291.          Width           =   1095
  292.       End
  293.       Begin VB.CommandButton cmdDraw 
  294.          Caption         =   "Draw"
  295.          Height          =   375
  296.          Left            =   1080
  297.          TabIndex        =   65
  298.          Top             =   6480
  299.          Width           =   1095
  300.       End
  301.       Begin VB.CommandButton cmdMove 
  302.          Caption         =   "Move"
  303.          Height          =   375
  304.          Left            =   2160
  305.          TabIndex        =   64
  306.          Top             =   6480
  307.          Width           =   1095
  308.       End
  309.       Begin VB.CommandButton cmdRun 
  310.          Caption         =   "Run"
  311.          Height          =   375
  312.          Left            =   600
  313.          TabIndex        =   63
  314.          Top             =   6840
  315.          Width           =   1095
  316.       End
  317.       Begin VB.CommandButton cmdReset 
  318.          Caption         =   "Reset Boids"
  319.          Height          =   375
  320.          Left            =   0
  321.          TabIndex        =   62
  322.          Top             =   6120
  323.          Width           =   1095
  324.       End
  325.       Begin VB.Frame Frame1 
  326.          Height          =   6135
  327.          Index           =   3
  328.          Left            =   2520
  329.          TabIndex        =   49
  330.          Top             =   0
  331.          Width           =   675
  332.          Begin VB.TextBox Text4 
  333.             Height          =   375
  334.             Index           =   3
  335.             Left            =   120
  336.             TabIndex        =   61
  337.             Text            =   "10"
  338.             Top             =   1680
  339.             Width           =   500
  340.          End
  341.          Begin VB.TextBox Text4 
  342.             Height          =   375
  343.             Index           =   2
  344.             Left            =   120
  345.             TabIndex        =   60
  346.             Text            =   "2"
  347.             Top             =   1200
  348.             Width           =   500
  349.          End
  350.          Begin VB.TextBox Text4 
  351.             Height          =   375
  352.             Index           =   1
  353.             Left            =   120
  354.             TabIndex        =   59
  355.             Text            =   "132"
  356.             Top             =   720
  357.             Width           =   500
  358.          End
  359.          Begin VB.TextBox Text4 
  360.             Height          =   375
  361.             Index           =   0
  362.             Left            =   120
  363.             TabIndex        =   58
  364.             Text            =   "143"
  365.             Top             =   240
  366.             Width           =   500
  367.          End
  368.          Begin VB.TextBox Text4 
  369.             Height          =   375
  370.             Index           =   4
  371.             Left            =   120
  372.             TabIndex        =   57
  373.             Text            =   "10"
  374.             Top             =   2160
  375.             Width           =   500
  376.          End
  377.          Begin VB.TextBox Text4 
  378.             Height          =   375
  379.             Index           =   5
  380.             Left            =   120
  381.             TabIndex        =   56
  382.             Text            =   "10"
  383.             Top             =   2640
  384.             Width           =   500
  385.          End
  386.          Begin VB.TextBox Text4 
  387.             Height          =   375
  388.             Index           =   6
  389.             Left            =   120
  390.             TabIndex        =   55
  391.             Text            =   "10"
  392.             Top             =   3120
  393.             Width           =   500
  394.          End
  395.          Begin VB.TextBox Text4 
  396.             Height          =   375
  397.             Index           =   7
  398.             Left            =   120
  399.             TabIndex        =   54
  400.             Text            =   "10"
  401.             Top             =   3600
  402.             Width           =   500
  403.          End
  404.          Begin VB.TextBox Text4 
  405.             Height          =   375
  406.             Index           =   8
  407.             Left            =   120
  408.             TabIndex        =   53
  409.             Text            =   "10"
  410.             Top             =   4080
  411.             Width           =   500
  412.          End
  413.          Begin VB.TextBox Text4 
  414.             Height          =   375
  415.             Index           =   9
  416.             Left            =   120
  417.             TabIndex        =   52
  418.             Text            =   "10"
  419.             Top             =   4560
  420.             Width           =   500
  421.          End
  422.          Begin VB.TextBox Text4 
  423.             Height          =   375
  424.             Index           =   10
  425.             Left            =   120
  426.             TabIndex        =   51
  427.             Text            =   "10"
  428.             Top             =   5040
  429.             Width           =   500
  430.          End
  431.          Begin VB.TextBox Text4 
  432.             Height          =   375
  433.             Index           =   11
  434.             Left            =   120
  435.             TabIndex        =   50
  436.             Text            =   "10"
  437.             Top             =   5520
  438.             Width           =   500
  439.          End
  440.       End
  441.       Begin VB.Frame Frame1 
  442.          Height          =   6135
  443.          Index           =   2
  444.          Left            =   1920
  445.          TabIndex        =   36
  446.          Top             =   120
  447.          Width           =   675
  448.          Begin VB.TextBox Text3 
  449.             Height          =   375
  450.             Index           =   3
  451.             Left            =   120
  452.             TabIndex        =   48
  453.             Text            =   "10"
  454.             Top             =   1680
  455.             Width           =   500
  456.          End
  457.          Begin VB.TextBox Text3 
  458.             Height          =   375
  459.             Index           =   2
  460.             Left            =   120
  461.             TabIndex        =   47
  462.             Text            =   "3"
  463.             Top             =   1200
  464.             Width           =   500
  465.          End
  466.          Begin VB.TextBox Text3 
  467.             Height          =   375
  468.             Index           =   1
  469.             Left            =   120
  470.             TabIndex        =   46
  471.             Text            =   "110"
  472.             Top             =   720
  473.             Width           =   500
  474.          End
  475.          Begin VB.TextBox Text3 
  476.             Height          =   375
  477.             Index           =   0
  478.             Left            =   120
  479.             TabIndex        =   45
  480.             Text            =   "118"
  481.             Top             =   240
  482.             Width           =   500
  483.          End
  484.          Begin VB.TextBox Text3 
  485.             Height          =   375
  486.             Index           =   4
  487.             Left            =   120
  488.             TabIndex        =   44
  489.             Text            =   "10"
  490.             Top             =   2160
  491.             Width           =   500
  492.          End
  493.          Begin VB.TextBox Text3 
  494.             Height          =   375
  495.             Index           =   5
  496.             Left            =   120
  497.             TabIndex        =   43
  498.             Text            =   "10"
  499.             Top             =   2640
  500.             Width           =   500
  501.          End
  502.          Begin VB.TextBox Text3 
  503.             Height          =   375
  504.             Index           =   6
  505.             Left            =   120
  506.             TabIndex        =   42
  507.             Text            =   "10"
  508.             Top             =   3120
  509.             Width           =   500
  510.          End
  511.          Begin VB.TextBox Text3 
  512.             Height          =   375
  513.             Index           =   7
  514.             Left            =   120
  515.             TabIndex        =   41
  516.             Text            =   "10"
  517.             Top             =   3600
  518.             Width           =   500
  519.          End
  520.          Begin VB.TextBox Text3 
  521.             Height          =   375
  522.             Index           =   8
  523.             Left            =   120
  524.             TabIndex        =   40
  525.             Text            =   "10"
  526.             Top             =   4080
  527.             Width           =   500
  528.          End
  529.          Begin VB.TextBox Text3 
  530.             Height          =   375
  531.             Index           =   9
  532.             Left            =   120
  533.             TabIndex        =   39
  534.             Text            =   "10"
  535.             Top             =   4560
  536.             Width           =   500
  537.          End
  538.          Begin VB.TextBox Text3 
  539.             Height          =   375
  540.             Index           =   10
  541.             Left            =   120
  542.             TabIndex        =   38
  543.             Text            =   "10"
  544.             Top             =   5040
  545.             Width           =   500
  546.          End
  547.          Begin VB.TextBox Text3 
  548.             Height          =   375
  549.             Index           =   11
  550.             Left            =   120
  551.             TabIndex        =   37
  552.             Text            =   "10"
  553.             Top             =   5520
  554.             Width           =   500
  555.          End
  556.       End
  557.       Begin VB.Frame Frame1 
  558.          Height          =   6135
  559.          Index           =   1
  560.          Left            =   1320
  561.          TabIndex        =   23
  562.          Top             =   120
  563.          Width           =   675
  564.          Begin VB.TextBox Text2 
  565.             Height          =   375
  566.             Index           =   3
  567.             Left            =   120
  568.             TabIndex        =   35
  569.             Text            =   "10"
  570.             Top             =   1680
  571.             Width           =   500
  572.          End
  573.          Begin VB.TextBox Text2 
  574.             Height          =   375
  575.             Index           =   2
  576.             Left            =   120
  577.             TabIndex        =   34
  578.             Text            =   "1"
  579.             Top             =   1200
  580.             Width           =   500
  581.          End
  582.          Begin VB.TextBox Text2 
  583.             Height          =   375
  584.             Index           =   1
  585.             Left            =   120
  586.             TabIndex        =   33
  587.             Text            =   "102"
  588.             Top             =   720
  589.             Width           =   500
  590.          End
  591.          Begin VB.TextBox Text2 
  592.             Height          =   375
  593.             Index           =   0
  594.             Left            =   120
  595.             TabIndex        =   32
  596.             Text            =   "153"
  597.             Top             =   240
  598.             Width           =   500
  599.          End
  600.          Begin VB.TextBox Text2 
  601.             Height          =   375
  602.             Index           =   4
  603.             Left            =   120
  604.             TabIndex        =   31
  605.             Text            =   "10"
  606.             Top             =   2160
  607.             Width           =   500
  608.          End
  609.          Begin VB.TextBox Text2 
  610.             Height          =   375
  611.             Index           =   5
  612.             Left            =   120
  613.             TabIndex        =   30
  614.             Text            =   "10"
  615.             Top             =   2640
  616.             Width           =   500
  617.          End
  618.          Begin VB.TextBox Text2 
  619.             Height          =   375
  620.             Index           =   6
  621.             Left            =   120
  622.             TabIndex        =   29
  623.             Text            =   "10"
  624.             Top             =   3120
  625.             Width           =   500
  626.          End
  627.          Begin VB.TextBox Text2 
  628.             Height          =   375
  629.             Index           =   7
  630.             Left            =   120
  631.             TabIndex        =   28
  632.             Text            =   "10"
  633.             Top             =   3600
  634.             Width           =   500
  635.          End
  636.          Begin VB.TextBox Text2 
  637.             Height          =   375
  638.             Index           =   8
  639.             Left            =   120
  640.             TabIndex        =   27
  641.             Text            =   "10"
  642.             Top             =   4080
  643.             Width           =   500
  644.          End
  645.          Begin VB.TextBox Text2 
  646.             Height          =   375
  647.             Index           =   9
  648.             Left            =   120
  649.             TabIndex        =   26
  650.             Text            =   "10"
  651.             Top             =   4560
  652.             Width           =   500
  653.          End
  654.          Begin VB.TextBox Text2 
  655.             Height          =   375
  656.             Index           =   10
  657.             Left            =   120
  658.             TabIndex        =   25
  659.             Text            =   "10"
  660.             Top             =   5040
  661.             Width           =   500
  662.          End
  663.          Begin VB.TextBox Text2 
  664.             Height          =   375
  665.             Index           =   11
  666.             Left            =   120
  667.             TabIndex        =   24
  668.             Text            =   "10"
  669.             Top             =   5520
  670.             Width           =   500
  671.          End
  672.       End
  673.       Begin VB.Frame Frame1 
  674.          Height          =   6135
  675.          Index           =   0
  676.          Left            =   720
  677.          TabIndex        =   10
  678.          Top             =   0
  679.          Width           =   675
  680.          Begin VB.TextBox Text1 
  681.             Height          =   375
  682.             Index           =   0
  683.             Left            =   120
  684.             TabIndex        =   22
  685.             Text            =   "120"
  686.             Top             =   240
  687.             Width           =   500
  688.          End
  689.          Begin VB.TextBox Text1 
  690.             Height          =   375
  691.             Index           =   1
  692.             Left            =   120
  693.             TabIndex        =   21
  694.             Text            =   "160"
  695.             Top             =   720
  696.             Width           =   500
  697.          End
  698.          Begin VB.TextBox Text1 
  699.             Height          =   375
  700.             Index           =   2
  701.             Left            =   120
  702.             TabIndex        =   20
  703.             Text            =   "0"
  704.             Top             =   1200
  705.             Width           =   500
  706.          End
  707.          Begin VB.TextBox Text1 
  708.             Height          =   375
  709.             Index           =   3
  710.             Left            =   120
  711.             TabIndex        =   19
  712.             Text            =   "10"
  713.             Top             =   1680
  714.             Width           =   500
  715.          End
  716.          Begin VB.TextBox Text1 
  717.             Height          =   375
  718.             Index           =   4
  719.             Left            =   120
  720.             TabIndex        =   18
  721.             Text            =   "10"
  722.             Top             =   2160
  723.             Width           =   500
  724.          End
  725.          Begin VB.TextBox Text1 
  726.             Height          =   375
  727.             Index           =   5
  728.             Left            =   120
  729.             TabIndex        =   17
  730.             Text            =   "10"
  731.             Top             =   2640
  732.             Width           =   500
  733.          End
  734.          Begin VB.TextBox Text1 
  735.             Height          =   375
  736.             Index           =   6
  737.             Left            =   120
  738.             TabIndex        =   16
  739.             Text            =   "10"
  740.             Top             =   3120
  741.             Width           =   500
  742.          End
  743.          Begin VB.TextBox Text1 
  744.             Height          =   375
  745.             Index           =   7
  746.             Left            =   120
  747.             TabIndex        =   15
  748.             Text            =   "10"
  749.             Top             =   3600
  750.             Width           =   500
  751.          End
  752.          Begin VB.TextBox Text1 
  753.             Height          =   375
  754.             Index           =   8
  755.             Left            =   120
  756.             TabIndex        =   14
  757.             Text            =   "10"
  758.             Top             =   4080
  759.             Width           =   500
  760.          End
  761.          Begin VB.TextBox Text1 
  762.             Height          =   375
  763.             Index           =   9
  764.             Left            =   120
  765.             TabIndex        =   13
  766.             Text            =   "10"
  767.             Top             =   4560
  768.             Width           =   500
  769.          End
  770.          Begin VB.TextBox Text1 
  771.             Height          =   375
  772.             Index           =   10
  773.             Left            =   120
  774.             TabIndex        =   12
  775.             Text            =   "10"
  776.             Top             =   5040
  777.             Width           =   500
  778.          End
  779.          Begin VB.TextBox Text1 
  780.             Height          =   375
  781.             Index           =   11
  782.             Left            =   120
  783.             TabIndex        =   11
  784.             Text            =   "10"
  785.             Top             =   5520
  786.             Width           =   500
  787.          End
  788.       End
  789.       Begin VB.Frame Frame2 
  790.          Height          =   6135
  791.          Left            =   0
  792.          TabIndex        =   2
  793.          Top             =   0
  794.          Visible         =   0   'False
  795.          Width           =   735
  796.          Begin VB.Label Label1 
  797.             Alignment       =   1  'Right Justify
  798.             Caption         =   "X"
  799.             Height          =   195
  800.             Index           =   0
  801.             Left            =   120
  802.             TabIndex        =   9
  803.             Top             =   360
  804.             Width           =   600
  805.          End
  806.          Begin VB.Label Label1 
  807.             Alignment       =   1  'Right Justify
  808.             Caption         =   "Y"
  809.             Height          =   195
  810.             Index           =   1
  811.             Left            =   100
  812.             TabIndex        =   8
  813.             Top             =   840
  814.             Width           =   600
  815.          End
  816.          Begin VB.Label Label1 
  817.             Alignment       =   1  'Right Justify
  818.             Caption         =   "DIR"
  819.             Height          =   195
  820.             Index           =   2
  821.             Left            =   100
  822.             TabIndex        =   7
  823.             Top             =   1320
  824.             Width           =   600
  825.          End
  826.          Begin VB.Label Label1 
  827.             Alignment       =   1  'Right Justify
  828.             Caption         =   "Len"
  829.             Height          =   195
  830.             Index           =   3
  831.             Left            =   100
  832.             TabIndex        =   6
  833.             Top             =   1800
  834.             Width           =   600
  835.          End
  836.          Begin VB.Label label2 
  837.             Alignment       =   1  'Right Justify
  838.             Caption         =   "Align"
  839.             ForeColor       =   &H00FF00FF&
  840.             Height          =   195
  841.             Index           =   1
  842.             Left            =   100
  843.             TabIndex        =   5
  844.             Top             =   2400
  845.             Width           =   600
  846.          End
  847.          Begin VB.Label label2 
  848.             Alignment       =   1  'Right Justify
  849.             Caption         =   "Centre"
  850.             ForeColor       =   &H0000FF00&
  851.             Height          =   195
  852.             Index           =   0
  853.             Left            =   100
  854.             TabIndex        =   4
  855.             Top             =   3360
  856.             Width           =   600
  857.          End
  858.          Begin VB.Label label2 
  859.             Alignment       =   1  'Right Justify
  860.             Caption         =   "Sep"
  861.             ForeColor       =   &H0000FFFF&
  862.             Height          =   195
  863.             Index           =   2
  864.             Left            =   100
  865.             TabIndex        =   3
  866.             Top             =   4440
  867.             Width           =   600
  868.          End
  869.       End
  870.    End
  871.    Begin VB.PictureBox Picture1 
  872.       AutoRedraw      =   -1  'True
  873.       AutoSize        =   -1  'True
  874.       BackColor       =   &H8000000E&
  875.       Height          =   7875
  876.       Left            =   1860
  877.       ScaleHeight     =   521
  878.       ScaleMode       =   3  'Pixel
  879.       ScaleWidth      =   613
  880.       TabIndex        =   0
  881.       Top             =   120
  882.       Width           =   9255
  883.    End
  884.    Begin VB.Menu mnuFile 
  885.       Caption         =   "&File"
  886.       Begin VB.Menu mnuAbout 
  887.          Caption         =   "&About"
  888.       End
  889.       Begin VB.Menu mnuSep1 
  890.          Caption         =   "-"
  891.       End
  892.       Begin VB.Menu mnuExit 
  893.          Caption         =   "E&xit"
  894.       End
  895.    End
  896. Attribute VB_Name = "frmMain"
  897. Attribute VB_GlobalNameSpace = False
  898. Attribute VB_Creatable = False
  899. Attribute VB_PredeclaredId = True
  900. Attribute VB_Exposed = False
  901. Option Explicit
  902. Private Declare Function VarPtrArray Lib "msvbvm50.dll" Alias "VarPtr" (Ptr() As Any) As Long
  903. Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDst As Any, pSrc As Any, ByVal ByteLen As Long)
  904. Private Declare Function GetObjectAPI Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As Long
  905. Private Declare Function GetTickCount Lib "kernel32" () As Long
  906. Private Type SAFEARRAYBOUND
  907.     cElements As Long
  908.     lLbound As Long
  909. End Type
  910. Private Type SAFEARRAY1D
  911.     cDims As Integer
  912.     fFeatures As Integer
  913.     cbElements As Long
  914.     cLocks As Long
  915.     pvData As Long
  916.     Bounds(0 To 0) As SAFEARRAYBOUND
  917. End Type
  918. Private Type SAFEARRAY2D
  919.     cDims As Integer
  920.     fFeatures As Integer
  921.     cbElements As Long
  922.     cLocks As Long
  923.     pvData As Long
  924.     Bounds(0 To 1) As SAFEARRAYBOUND
  925. End Type
  926. Private Type BITMAP
  927.     bmType As Long
  928.     bmWidth As Long
  929.     bmHeight As Long
  930.     bmWidthBytes As Long
  931.     bmPlanes As Integer
  932.     bmBitsPixel As Integer
  933.     bmBits As Long
  934. End Type
  935. Private Type point
  936.     r As Byte
  937.     c As Byte
  938. End Type
  939. Dim dwn%
  940. Dim bkg(255, 255) As Byte
  941. Dim blnRun As Boolean
  942. Dim iXval As Integer
  943. Dim iYval As Integer
  944. Private Sub cmdCalcForces_Click()
  945. Dim boid As BoidClass
  946.     CalcForces flock, HScroll1(0), HScroll1(1), HScroll1(2), Val(Text5), Val(Text7)
  947.     For Each boid In flock
  948.         Select Case boid.id
  949.         Case 0
  950.             Text1(4) = boid.DesireAlignTurn
  951.             Text1(5) = boid.DesireAlignWeight
  952.             Text1(6) = boid.DesireCentreTurn
  953.             Text1(7) = boid.DesireCentreWeight
  954.             Text1(8) = boid.DesireSeparateTurn
  955.             Text1(9) = boid.DesireSeparateWeight
  956.             Text1(10) = boid.AveX
  957.             Text1(11) = boid.AveY
  958.         Case 1
  959.             Text2(4) = boid.DesireAlignTurn
  960.             Text2(5) = boid.DesireAlignWeight
  961.             Text2(6) = boid.DesireCentreTurn
  962.             Text2(7) = boid.DesireCentreWeight
  963.             Text2(8) = boid.DesireSeparateTurn
  964.             Text2(9) = boid.DesireSeparateWeight
  965.             Text2(10) = boid.AveX
  966.             Text2(11) = boid.AveY
  967.         Case 2
  968.             Text3(4) = boid.DesireAlignTurn
  969.             Text3(5) = boid.DesireAlignWeight
  970.             Text3(6) = boid.DesireCentreTurn
  971.             Text3(7) = boid.DesireCentreWeight
  972.             Text3(8) = boid.DesireSeparateTurn
  973.             Text3(9) = boid.DesireSeparateWeight
  974.             Text3(10) = boid.AveX
  975.             Text3(11) = boid.AveY
  976.         Case 3
  977.             Text4(4) = boid.DesireAlignTurn
  978.             Text4(5) = boid.DesireAlignWeight
  979.             Text4(6) = boid.DesireCentreTurn
  980.             Text4(7) = boid.DesireCentreWeight
  981.             Text4(8) = boid.DesireSeparateTurn
  982.             Text4(9) = boid.DesireSeparateWeight
  983.             Text4(10) = boid.AveX
  984.             Text4(11) = boid.AveY
  985.         End Select
  986.         
  987.     Next
  988.     Set boid = Nothing
  989. End Sub
  990. Private Sub cmdClear_Click()
  991.     Picture1.Cls
  992. End Sub
  993. Private Sub cmdDraw_Click()
  994. Dim i%, j%
  995.     For i% = 0 To Picture1.ScaleWidth Step 10
  996.         Picture1.Line (i%, 0)-(i%, Picture1.ScaleHeight), vbButtonFace
  997.     Next
  998.     For i% = 0 To Picture1.ScaleHeight Step 10
  999.         Picture1.Line (0, i%)-(Picture1.ScaleWidth, i%), vbButtonFace
  1000.     Next
  1001.     DrawBoid flock, Me.Picture1, Me.chkShowColours, Me.chkShowArrow, Me.chkShowCircle
  1002.     DrawObjects objects, Me.Picture1
  1003.     DrawForces flock, Me.Picture1, Val(Text5), Val(Text7), Me.chkShowCentre, Me.chkShowSep, Me.chkShowAlign, Me.chkShowSensor, Me.chkShowBox
  1004. End Sub
  1005. Private Sub cmdExecute_Click()
  1006. Dim i%, j%
  1007. Dim boid As BoidClass
  1008. Select Case cmdExecute.Caption
  1009. Case "Execute"
  1010.     cmdExecute.Caption = "Stop"
  1011.     blnRun = True
  1012.     Do
  1013.         CalcForces flock, HScroll1(0), HScroll1(1), HScroll1(2), Val(Text5), Val(Text7)
  1014.         If Me.chkTrails = False Then
  1015.             Picture1.Cls
  1016.         End If
  1017.         
  1018.         If Me.chkGrid <> False Then
  1019.             For i% = 0 To Picture1.ScaleWidth Step 10
  1020.                 Picture1.Line (i%, 0)-(i%, Picture1.ScaleHeight), vbButtonFace
  1021.             Next
  1022.             For i% = 0 To Picture1.ScaleHeight Step 10
  1023.                 Picture1.Line (0, i%)-(Picture1.ScaleWidth, i%), vbButtonFace
  1024.             Next
  1025.         End If
  1026.         
  1027.         DrawBoid flock, Me.Picture1, Me.chkShowColours, Me.chkShowArrow, Me.chkShowCircle
  1028.         DrawObjects objects, Me.Picture1
  1029.         
  1030.         DrawForces flock, Me.Picture1, Val(Text5), Val(Text7), Me.chkShowCentre, Me.chkShowSep, Me.chkShowAlign, Me.chkShowSensor, Me.chkShowBox
  1031.         DoEvents
  1032.         
  1033.         MoveBoid flock, Val(Text6), Picture1.ScaleHeight, Picture1.ScaleWidth, Val(Text5), Me.chkEnclosed
  1034.         
  1035.     Loop While blnRun = True
  1036. Case "Stop"
  1037.     cmdExecute.Caption = "Execute"
  1038.     blnRun = False
  1039. End Select
  1040.  End Sub
  1041. Private Sub cmdExit_Click()
  1042.     Unload Me
  1043. End Sub
  1044. Private Sub cmdMove_Click()
  1045.     MoveBoid flock, Val(Text6), Picture1.ScaleHeight, Picture1.ScaleWidth, Val(Text5), Me.chkEnclosed
  1046. End Sub
  1047. Private Sub cmdReset_Click()
  1048. Dim boid As BoidClass
  1049.     For Each boid In flock
  1050.         Select Case boid.id
  1051.         Case 0
  1052.             Text1(0) = 100
  1053.             Text1(1) = 150
  1054.             Text1(2) = 0
  1055.         Case 1
  1056.             Text2(0) = 100
  1057.             Text2(1) = 160
  1058.             Text2(2) = 0
  1059.         Case 2
  1060.             Text3(0) = 400
  1061.             Text3(1) = 430
  1062.             Text3(2) = 2
  1063.         Case 3
  1064.             Text4(0) = 400
  1065.             Text4(1) = 440
  1066.             Text4(2) = 2
  1067.         End Select
  1068.         
  1069.     Next
  1070.     Set boid = Nothing
  1071. End Sub
  1072. Private Sub cmdRun_Click()
  1073.     Picture1.Cls
  1074. Dim boid As BoidClass
  1075.     CalcForces flock, HScroll1(0), HScroll1(1), HScroll1(2), Val(Text5), Val(Text7)
  1076.     For Each boid In flock
  1077.         Select Case boid.id
  1078.             Case 0
  1079.                 Text1(0) = boid.X
  1080.                 Text1(1) = boid.Y
  1081.                 Text1(2) = boid.direction
  1082.                 Text1(3) = boid.ClosestDist
  1083.                 
  1084.                 Text1(4) = boid.DesireAlignTurn
  1085.                 Text1(5) = boid.DesireAlignWeight
  1086.                 Text1(6) = boid.DesireCentreTurn
  1087.                 Text1(7) = boid.DesireCentreWeight
  1088.                 Text1(8) = boid.DesireSeparateTurn
  1089.                 Text1(9) = boid.DesireSeparateWeight
  1090.                 Text1(10) = boid.AveX
  1091.                 Text1(11) = boid.AveY
  1092.             Case 1
  1093.                 Text2(0) = boid.X
  1094.                 Text2(1) = boid.Y
  1095.                 Text2(2) = boid.direction
  1096.                 Text2(3) = boid.ClosestDist
  1097.                 
  1098.                 Text2(4) = boid.DesireAlignTurn
  1099.                 Text2(5) = boid.DesireAlignWeight
  1100.                 Text2(6) = boid.DesireCentreTurn
  1101.                 Text2(7) = boid.DesireCentreWeight
  1102.                 Text2(8) = boid.DesireSeparateTurn
  1103.                 Text2(9) = boid.DesireSeparateWeight
  1104.                 Text2(10) = boid.AveX
  1105.                 Text2(11) = boid.AveY
  1106.             Case 2
  1107.                 Text3(0) = boid.X
  1108.                 Text3(1) = boid.Y
  1109.                 Text3(2) = boid.direction
  1110.                 Text3(3) = boid.ClosestDist
  1111.                 Text3(3) = boid.AveSpeed
  1112.                 Text3(4) = boid.DesireAlignTurn
  1113.                 Text3(5) = boid.DesireAlignWeight
  1114.                 Text3(6) = boid.DesireCentreTurn
  1115.                 Text3(7) = boid.DesireCentreWeight
  1116.                 Text3(8) = boid.DesireSeparateTurn
  1117.                 Text3(9) = boid.DesireSeparateWeight
  1118.                 Text3(10) = boid.AveX
  1119.                 Text3(11) = boid.AveY
  1120.             Case 3
  1121.                 Text4(0) = boid.X
  1122.                 Text4(1) = boid.Y
  1123.                 Text4(2) = boid.direction
  1124.                 Text4(3) = boid.ClosestDist
  1125.                 Text4(3) = boid.AveSpeed
  1126.                 Text4(4) = boid.DesireAlignTurn
  1127.                 Text4(5) = boid.DesireAlignWeight
  1128.                 Text4(6) = boid.DesireCentreTurn
  1129.                 Text4(7) = boid.DesireCentreWeight
  1130.                 Text4(8) = boid.DesireSeparateTurn
  1131.                 Text4(9) = boid.DesireSeparateWeight
  1132.                 Text4(10) = boid.AveX
  1133.                 Text4(11) = boid.AveY
  1134.         End Select
  1135.         
  1136.     Next
  1137.     Set boid = Nothing
  1138. Dim i%, j%
  1139.     For i% = 0 To Picture1.ScaleWidth Step 10
  1140.         Picture1.Line (i%, 0)-(i%, Picture1.ScaleHeight), vbButtonFace
  1141.     Next
  1142.     For i% = 0 To Picture1.ScaleHeight Step 10
  1143.         Picture1.Line (0, i%)-(Picture1.ScaleWidth, i%), vbButtonFace
  1144.     Next
  1145.     DrawBoid flock, Me.Picture1, Me.chkShowColours, Me.chkShowArrow, Me.chkShowCircle
  1146.     DrawObjects objects, Me.Picture1
  1147.     DrawForces flock, Me.Picture1, Val(Text5), Val(Text7), Me.chkShowCentre, Me.chkShowSep, Me.chkShowAlign, Me.chkShowSensor, Me.chkShowBox
  1148.     MoveBoid flock, Val(Text6), Picture1.ScaleHeight, Picture1.ScaleWidth, Val(Text5), Me.chkEnclosed
  1149. End Sub
  1150. Private Sub cmdSet_Click()
  1151. Dim i%
  1152. Dim H As Integer
  1153. Dim Theta As Double
  1154. Dim X As Integer
  1155. Dim Y As Integer
  1156. Dim NewX As Integer
  1157. Dim NewY As Integer
  1158.     Do While flock.Count > 0
  1159.         flock.Remove 1
  1160.     Loop
  1161. 'Boid0
  1162.     X = Val(Text1(0))
  1163.     Y = Val(Text1(1))
  1164.     Theta = Val(Text1(2))
  1165.     H = Val(Text1(3))
  1166.     AddBoid flock, X, Y, Theta, vbBlue
  1167.     Sin (1)
  1168. 'Boid1
  1169.     X = Val(Text2(0))
  1170.     Y = Val(Text2(1))
  1171.     Theta = Val(Text2(2))
  1172.     H = Val(Text2(3))
  1173.     AddBoid flock, X, Y, Theta, vbBlack
  1174. 'Boid2
  1175.     X = Val(Text3(0))
  1176.     Y = Val(Text3(1))
  1177.     Theta = Val(Text3(2))
  1178.     H = Val(Text3(3))
  1179.     AddBoid flock, X, Y, Theta, vbBlack
  1180. 'Boid2
  1181.     X = Val(Text4(0))
  1182.     Y = Val(Text4(1))
  1183.     Theta = Val(Text4(2))
  1184.     H = Val(Text4(3))
  1185.     AddBoid flock, X, Y, Theta, vbBlack
  1186.         
  1187. End Sub
  1188. Private Sub Command1_Click()
  1189.     Do While objects.Count > 0
  1190.         objects.Remove 1
  1191.     Loop
  1192. End Sub
  1193. Private Sub Form_Load()
  1194. Dim i%
  1195.     Randomize
  1196.     Label3(6) = "Boid Connt : " & HScroll1(3).Value
  1197.     For i% = 0 To Val(Mid$(Label3(6), 13))
  1198.         AddBoid flock, Int(Rnd(1) * 500), Int(Rnd(1) * 500), Rnd(1) * 6, vbBlack
  1199.     Next
  1200. '    For i% = 0 To 4
  1201. '        AddObstacle objects, Int(Rnd(1) * 300) + 100, Int(Rnd(1) * 300) + 100, 25
  1202. '    Next
  1203.     AddStartupObs
  1204. End Sub
  1205. Sub AddStartupObs()
  1206.         
  1207.         Do While objects.Count > 0
  1208.             objects.Remove 1
  1209.         Loop
  1210.         
  1211.         Picture1.Cls
  1212.         AddObstacle objects, Picture1.ScaleWidth / 2, Picture1.ScaleHeight / 2, 20
  1213.         AddObstacle objects, (Picture1.ScaleWidth / 2) + 100, Picture1.ScaleHeight / 2, 20
  1214.         AddObstacle objects, Picture1.ScaleWidth / 2, (Picture1.ScaleHeight / 2) + 100, 20
  1215.         AddObstacle objects, (Picture1.ScaleWidth / 2) - 100, Picture1.ScaleHeight / 2, 20
  1216.         AddObstacle objects, Picture1.ScaleWidth / 2, (Picture1.ScaleHeight / 2) - 100, 20
  1217.         
  1218.         AddObstacle objects, 0, 0, 50
  1219.         AddObstacle objects, Picture1.ScaleWidth, 0, 50
  1220.         AddObstacle objects, 0, Picture1.ScaleHeight, 50
  1221.         AddObstacle objects, Picture1.ScaleWidth, Picture1.ScaleHeight, 50
  1222. End Sub
  1223. Private Sub Form_Resize()
  1224.     Picture1.Width = Me.Width - Frame4.Width - 200
  1225.     Picture1.Height = Me.Height - 900
  1226.     AddStartupObs
  1227. End Sub
  1228. Private Sub Form_Unload(Cancel As Integer)
  1229.     If cmdExecute.Caption = "Stop" Then
  1230.         cmdExecute.Value = True
  1231.     End If
  1232.     End
  1233. End Sub
  1234. Private Sub HScroll1_Change(Index As Integer)
  1235.     Select Case Index
  1236.     Case 3
  1237.         Label3(6) = "Boid Connt : " & HScroll1(3).Value
  1238.         Do While flock.Count > Val(Mid$(Label3(6), 13))
  1239.             flock.Remove 1
  1240.         Loop
  1241.         Do While flock.Count < Val(Mid$(Label3(6), 13))
  1242.             AddBoid flock, Int(Rnd(1) * 500), Int(Rnd(1) * 500), Rnd(1) * 6, vbBlack
  1243.         Loop
  1244.        
  1245.     End Select
  1246. End Sub
  1247. Private Sub mnuAbout_Click()
  1248.     frmAbout.Show vbModal
  1249. End Sub
  1250. Private Sub mnuExit_Click()
  1251.     Unload Me
  1252. End Sub
  1253. Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  1254. '    iXval = X
  1255. '    iYval = Y
  1256. End Sub
  1257. Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  1258.     iXval = X
  1259.     iYval = Y
  1260.     AddObstacle objects, iXval, iYval, 25
  1261. End Sub
  1262.